Extend a list without appendΒΆ
Extend a list without append.
Sample data:
[10, 20, 30]
[40, 50, 60]
Expected output:
[40, 50, 60, 10, 20, 30]
L1 = [10, 20, 30]
L2 = [40, 50, 60]
L2[:0] = L1
print(L2)
Output:
[10, 20, 30, 40, 50, 60]